<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>


<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">



  <meta name="description" content="微信公众号开发Django-JSSDK授权"/>




  <meta name="keywords" content="Django, 微信公众号, 八一" />



  <meta name="baidu-site-verification" content="HhUstaSjr0" />



  <meta name="google-site-verification" content="UA-102975942-1" />






  <link rel="alternate" href="/atom.xml" title="八一">




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=2.6.0" />



<link rel="canonical" href="https://bay1.top/2018/06/21/微信公众号开发Django-JSSDK授权/"/>


<link rel="stylesheet" type="text/css" href="/css/style.css?v=2.6.0" />
<link rel="stylesheet" type="text/css" href="/css/prettify.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/css/sons-of-obsidian.css" media="screen" />



  <link rel="stylesheet" type="text/css" href="/lib/fancybox/jquery.fancybox.css" />




  
  <script id="baidu_analytics">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?9a885cc9fb6cd7bcef579deb8efe8a70";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>



  <script id="google_analytics">
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-102975942-1', 'auto');
        ga('send', 'pageview');
  </script>










    <title> 微信公众号开发Django-JSSDK授权 - 八一 </title>
  </head>

  <body><div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/." class="logo">八一</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>

<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    
      <a href="/archives">
        <li class="mobile-menu-item">
          
          
            文章
          
        </li>
      </a>
    
      <a href="/tags">
        <li class="mobile-menu-item">
          
          
            标签
          
        </li>
      </a>
    
      <a href="/about">
        <li class="mobile-menu-item">
          
          
            关于/友链
          
        </li>
      </a>
    
      <a href="/search">
        <li class="mobile-menu-item">
          
          
            站内搜索
          
        </li>
      </a>
    
  </ul>
</nav>

    <div class="container" id="mobile-panel">
      <header id="header" class="header"><div class="logo-wrapper">
  <a href="/." class="logo">八一</a>
</div>

<nav class="site-navbar">
  
    <ul id="menu" class="menu">
      
        <li class="menu-item">
          <a class="menu-item-link" href="/archives">
            
            
              文章
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/tags">
            
            
              标签
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/about">
            
            
              关于/友链
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/search">
            
            
              站内搜索
            
          </a>
        </li>
      
    </ul>
  
</nav>

      </header>

      <main id="main" class="main">
        <div class="content-wrapper">
          <div id="content" class="content">
            
  
  <article class="post">
    <header class="post-header">
      <h1 class="post-title">
        
          微信公众号开发Django-JSSDK授权
        
      </h1>

      <div class="post-meta">
        <span class="post-time">
          2018-06-21
        </span>
        
        
        
      </div>
    </header>

    
    
  <div class="post-toc" id="post-toc">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#获取ticket部分"><span class="toc-text">获取ticket部分</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#signature生成"><span class="toc-text">signature生成</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#wx接口验证"><span class="toc-text">wx接口验证</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Django-Ajax-CSRF"><span class="toc-text">Django-Ajax-CSRF</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#各种问题"><span class="toc-text">各种问题</span></a></li></ol>
    </div>
  </div>


    <div class="post-content">
      
        <p>上篇已经介绍过网页授权的基本操作，在进行网页开发的时候<br>也会遇到JSSDK授权的问题<br><a id="more"></a></p>
<blockquote>
<p>警示：此JSSDK授权可能坑比较多~<br>如出现各种问题，可以到文末检查</p>
</blockquote>
<p>部分代码上一篇文章已经提到解释，可以参考<br>另外如果出现非官方网页的提示，则不要在微信客户端调试<br>使用微信web开发者工具就可以了</p>
<h2 id="获取ticket部分"><a href="#获取ticket部分" class="headerlink" title="获取ticket部分"></a>获取ticket部分</h2><blockquote>
<p>此处官方文档明确提到用户需要缓存jsapi_ticket<br>因为其api调用次数非常有限,根据文档说明我把获取基础支持的acess_token和ticket写到了一起<br>代码如下</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#xgc.wechat.py</span></span><br><span class="line">app_id=os.environ.get(<span class="string">'APP_ID'</span>)</span><br><span class="line">app_secret=os.environ.get(<span class="string">'APP_SECRET'</span>)</span><br><span class="line"><span class="comment">#基础授权部分</span></span><br><span class="line">base_get_access_token = <span class="string">'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&amp;appid=%s&amp;secret=%s'</span>%(app_id,app_secret)</span><br><span class="line">get_ticket = <span class="string">'https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&amp;access_token='</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#views.py</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">base_authorization</span><span class="params">()</span>:</span></span><br><span class="line"></span><br><span class="line"><span class="meta">    @classmethod</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_ticket</span><span class="params">(self)</span>:</span></span><br><span class="line">        key = <span class="string">'ticket'</span></span><br><span class="line">        <span class="keyword">if</span> cache.has_key(key):</span><br><span class="line">            ticket  = cache.get(key)</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            <span class="keyword">if</span> cache.has_key(<span class="string">'access_token'</span>):</span><br><span class="line">                access_token = cache.get(<span class="string">'access_token'</span>)</span><br><span class="line">            <span class="keyword">else</span>:</span><br><span class="line">                access_token = self.get_access_token()</span><br><span class="line">            <span class="keyword">from</span> xgc.wechat <span class="keyword">import</span> get_ticket</span><br><span class="line">            ticket = requests.get(get_ticket+access_token).json()[<span class="string">'ticket'</span>]</span><br><span class="line">            cache.set(key,ticket,<span class="number">110</span>*<span class="number">60</span>)</span><br><span class="line">        <span class="keyword">return</span> ticket</span><br><span class="line"></span><br><span class="line"><span class="meta">    @classmethod</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_access_token</span><span class="params">(self)</span>:</span></span><br><span class="line">        <span class="keyword">from</span> xgc.wechat <span class="keyword">import</span> base_get_access_token</span><br><span class="line">        key = <span class="string">'access_token'</span></span><br><span class="line">        access_token = requests.get(base_get_access_token).json()[<span class="string">'access_token'</span>]</span><br><span class="line">        cache.set(key,access_token,<span class="number">110</span>*<span class="number">60</span>)</span><br><span class="line">        <span class="keyword">return</span> access_token</span><br></pre></td></tr></table></figure>
<h2 id="signature生成"><a href="#signature生成" class="headerlink" title="signature生成"></a>signature生成</h2><blockquote>
<p>首先我们signature生成需要一下几个参数noncestr（随机字符串）, 有效的jsapi_ticket, timestamp（时间戳）, url（当前网页的URL，不包含#及其后面部分)<br>其中官方提供了signature生成的python例子，如下的signature类，其中jsapi_ticket取自上方的ticket</p>
</blockquote>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">signature</span><span class="params">(View)</span>:</span></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self,url)</span>:</span></span><br><span class="line">        self.ret = &#123;</span><br><span class="line">            <span class="string">'nonceStr'</span>: self.__create_nonce_str(),</span><br><span class="line">            <span class="string">'jsapi_ticket'</span>: base_authorization.get_ticket(),</span><br><span class="line">            <span class="string">'timestamp'</span>: self.__create_timestamp(),</span><br><span class="line">            <span class="string">'url'</span>: url</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">__create_nonce_str</span><span class="params">(self)</span>:</span></span><br><span class="line">        <span class="keyword">return</span> <span class="string">''</span>.join(random.choice(string.ascii_letters + string.digits) <span class="keyword">for</span> _ <span class="keyword">in</span> range(<span class="number">15</span>))</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">__create_timestamp</span><span class="params">(self)</span>:</span></span><br><span class="line">        <span class="keyword">return</span> int(time.time())</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">sign</span><span class="params">(self)</span>:</span></span><br><span class="line">        string = <span class="string">'&amp;'</span>.join([<span class="string">'%s=%s'</span> % (key.lower(), self.ret[key]) <span class="keyword">for</span> key <span class="keyword">in</span> sorted(self.ret)]).encode(<span class="string">'utf-8'</span>)</span><br><span class="line">        self.ret[<span class="string">'signature'</span>] = hashlib.sha1(string).hexdigest()</span><br><span class="line">        <span class="keyword">return</span> self.ret</span><br></pre></td></tr></table></figure>
<h2 id="wx接口验证"><a href="#wx接口验证" class="headerlink" title="wx接口验证"></a>wx接口验证</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># urls.py</span></span><br><span class="line">url(<span class="string">r'^activity'</span>, views.activity.as_view(), name=<span class="string">'activity'</span>),</span><br><span class="line"></span><br><span class="line"><span class="comment"># views.py</span></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">activity</span><span class="params">(View)</span>:</span></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get</span><span class="params">(self, request)</span>:</span></span><br><span class="line">        <span class="keyword">return</span> render(request, <span class="string">'activaty.html'</span>)</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">post</span><span class="params">(self,request,*args, **kwargs)</span>:</span></span><br><span class="line">        request_type = request.POST.get(<span class="string">'type'</span>)</span><br><span class="line">        <span class="keyword">if</span> <span class="keyword">not</span> request_type:</span><br><span class="line">            request_body = json.loads(request.body.decode())</span><br><span class="line">            pathname = request_body[<span class="string">'url'</span>]</span><br><span class="line">            sign = signature(unquote(pathname))</span><br><span class="line">            sign = json.dumps(sign.sign())</span><br><span class="line">            <span class="keyword">return</span> HttpResponse(sign, content_type=<span class="string">"application/json"</span>)</span><br><span class="line">        <span class="keyword">elif</span> request_type == <span class="string">'image/jpeg'</span>:</span><br><span class="line">            <span class="keyword">pass</span> <span class="comment">#传图片的时候会用到</span></span><br></pre></td></tr></table></figure>
<blockquote>
<p>首先我们先设置和前端进行交互的路由,然后我们利用下面的js进行wx初始配置</p>
</blockquote>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">csrfSafeMethod</span>(<span class="params">method</span>) </span>&#123;</span><br><span class="line">    <span class="comment">// these HTTP methods do not require CSRF protection</span></span><br><span class="line">    <span class="keyword">return</span> (<span class="regexp">/^(GET|HEAD|OPTIONS|TRACE)$/</span>.test(method));</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">$.ajaxSetup(&#123;</span><br><span class="line">    beforeSend: <span class="function"><span class="keyword">function</span> (<span class="params">xhr, settings</span>) </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (!csrfSafeMethod(settings.type) &amp;&amp; !<span class="keyword">this</span>.crossDomain) &#123;</span><br><span class="line">            xhr.setRequestHeader(<span class="string">"X-CSRFToken"</span>, <span class="string">'&#123;&#123; csrf_token &#125;&#125;'</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;,</span><br><span class="line">&#125;);</span><br><span class="line"><span class="comment">//上方为Django-Ajax-CSRF设置</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> wxStatus = <span class="number">0</span></span><br><span class="line"></span><br><span class="line">$(<span class="built_in">document</span>).ready(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    $.ajax(&#123;</span><br><span class="line">        type: <span class="string">'POST'</span>,</span><br><span class="line">        url: <span class="string">"http://test.flywinky.top/activity"</span>, <span class="comment">// class activity设置的链接</span></span><br><span class="line">        data: <span class="built_in">JSON</span>.stringify(&#123; <span class="string">'url'</span>: <span class="built_in">encodeURIComponent</span>(location.href.split(<span class="string">'#'</span>)[<span class="number">0</span>]) &#125;),</span><br><span class="line">        headers: &#123; <span class="string">'Content-Type'</span>: <span class="string">'application/json'</span> &#125;,</span><br><span class="line">        success: <span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;</span><br><span class="line">            wx.config(&#123;</span><br><span class="line">                debug: <span class="literal">false</span>,</span><br><span class="line">                appId: <span class="string">'wx4f35679866a1b3a6'</span>,</span><br><span class="line">                timestamp: res[<span class="string">'timestamp'</span>],</span><br><span class="line">                nonceStr: res[<span class="string">'nonceStr'</span>],</span><br><span class="line">                signature: res[<span class="string">'signature'</span>],</span><br><span class="line">                jsApiList: [<span class="string">'chooseImage'</span>, <span class="string">'uploadImage'</span>]</span><br><span class="line">            &#125;)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">    wx.ready(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        wxStatus = <span class="number">1</span></span><br><span class="line">    &#125;)</span><br><span class="line">    wx.error(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;</span><br><span class="line">        wxStatus = <span class="number">2</span></span><br><span class="line">    &#125;)</span><br></pre></td></tr></table></figure>
<p>正常的情况如下图<br><img src="https://s1.ax1x.com/2018/06/21/PS7JNn.png" alt=""></p>
<p>然后就可以调用官方的各个接口了，只要你有相应的权限<br><a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&amp;id=mp1421141115" target="_blank" rel="noopener">接口列表在网页下方</a></p>
<h3 id="Django-Ajax-CSRF"><a href="#Django-Ajax-CSRF" class="headerlink" title="Django-Ajax-CSRF"></a>Django-Ajax-CSRF</h3><blockquote>
<p>Django默认开启了CSRF验证<br>在进行Ajax请求POST的时候需要注意csrf_token的设置<br><a href="https://docs.djangoproject.com/en/2.0/ref/csrf/#ajax" target="_blank" rel="noopener">官网文档这样写的</a><br>也可以按照我上方的代码,在html里</p>
</blockquote>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&#123;% load static %&#125;</span><br><span class="line">&#123;&#123; csrf_token &#125;&#125; //就可以直接这样引入了</span><br></pre></td></tr></table></figure>
<h2 id="各种问题"><a href="#各种问题" class="headerlink" title="各种问题"></a>各种问题</h2><p>首先推荐一篇帖子<a href="https://segmentfault.com/q/1010000002520634" target="_blank" rel="noopener">微信公众平台, config:invalid signature一直爆这个错误，求教如何解决？</a></p>
<p>官网文档总结：</p>
<p>invalid signature签名错误。建议按如下顺序检查：</p>
<ul>
<li>确认签名算法正确，可用<a href="http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign" target="_blank" rel="noopener">http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign</a> 页面工具进行校验。</li>
<li>确认config中nonceStr（js中驼峰标准大写S）, timestamp与用以签名中的对应noncestr, timestamp一致。</li>
<li>确认url是页面完整的url(请在当前页面alert(location.href.split(‘#’)[0])确认)，包括’http(s)://‘部分，以及’？’后面的GET参数部分,但不包括’#’hash后面的部分。</li>
<li>确认 config 中的 appid 与用来获取 jsapi_ticket 的 appid 一致。</li>
<li>确保一定缓存access_token和jsapi_ticket。</li>
<li>确保你获取用来签名的url是动态获取的，动态页面可参见实例代码中php的实现方式。如果是html的静态页面在前端通过ajax将url传到后台签名，前端需要用js获取当前页面除去’#’hash部分的链接（可用location.href.split(‘#’)[0]获取,而且需要encodeURIComponent），因为页面一旦分享，微信客户端会在你的链接末尾加入其它参数，如果不是动态获取当前链接，将导致分享后的页面签名失败。</li>
</ul>
<p>还有：</p>
<ul>
<li>获取微信的jsapi_ticket有两个URL地址，一个是：<a href="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&amp;type=wx_card" target="_blank" rel="noopener">https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&amp;type=wx_card</a><br>另外一个是：<a href="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&amp;type=jsapi" target="_blank" rel="noopener">https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&amp;type=jsapi</a><br>第一个微信卡券的地址，应该是用第二个地址。</li>
<li>此处的access_token为基础支持的access_token，和网页授权的不同</li>
<li>url在JavaScript中千万别忘记“encodeURIComponent”！否则后果很诡异，遇到过初始化的时候报invalid<br>signature，但是API接口又能调用的情况。</li>
</ul>

      
    </div>

    
      
      



      
      
    

    
      <footer class="post-footer">
        
          <div class="post-tags">
            
              <a href="/tags/Django/">Django</a>
            
              <a href="/tags/微信公众号/">微信公众号</a>
            
          </div>
        
        
        
  <nav class="post-nav">
    
      <a class="prev" href="/2018/06/21/微信公众号开发Django-图片处理/">
        <i class="iconfont icon-left"></i>
        <span class="prev-text nav-default">微信公众号开发Django-图片处理</span>
        <span class="prev-text nav-mobile">上一篇</span>
      </a>
    
    
      <a class="next" href="/2018/06/21/微信公众号开发Django-网页授权/">
        <span class="next-text nav-default">微信公众号开发Django-网页授权</span>
        <span class="prev-text nav-mobile">下一篇</span>
        <i class="iconfont icon-right"></i>
      </a>
    
  </nav>

      </footer>
    

  </article>


          </div>
          
  <div class="comments" id="comments">
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div> 
    </div>
  </div>


        </div>
      </main>

      <footer id="footer" class="footer">

  <div class="social-links">
    
      
        
          <a href="https://github.com/bay1" class="iconfont icon-github" title="github"></a>
        
      
    
      
        
          <a href="http://weibo.com/3190704711/profile?topnav=1&wvr=6&is_all=1" class="iconfont icon-weibo" title="weibo"></a>
        
      
    
      
    
      
    
      
    
    
    
  </div>


<div class="copyright">
  <span class="copyright-year">
    
    &copy; 
     
      2016 - 
    
    2018
    <span class="author">bay1</span>
  </span>
</div>
      </footer>

      <div class="back-to-top" id="back-to-top">
        <i class="iconfont icon-up"></i>
      </div>
    </div>

    
  
  <script type="text/javascript">
    var disqus_config = function () {
        this.page.url = 'https://bay1.top/2018/06/21/微信公众号开发Django-JSSDK授权/';
        this.page.identifier = '2018/06/21/微信公众号开发Django-JSSDK授权/';
        this.page.title = '微信公众号开发Django-JSSDK授权';
    };
    (function() {
    var d = document, s = d.createElement('script');

    s.src = '//https-blog-flywinky-top-1.disqus.com/embed.js';

    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();  
  </script>



    
  





  
    <script type="text/javascript" src="/lib/jquery/jquery-3.1.1.min.js"></script>
  

  
    <script type="text/javascript" src="/lib/slideout/slideout.js"></script>
  

  
    <script type="text/javascript" src="/lib/fancybox/jquery.fancybox.pack.js"></script>
  


    <script type="text/javascript" src="/js/src/even.js?v=2.6.0"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=2.6.0"></script>
<script src="/js/prettify.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 $('pre').addClass('prettyprint');
   prettyPrint();
 })
</script>
  </body>
</html>
